#include <linux/module.h>
#include <linux/platform_device.h>
#ifdef S3C2440
#include <mach/gpio-samsung.h>
#else
#include <cfg_type.h>
#endif

static struct resource led_resources[] = {
#ifdef S3C2440
	[0] = {
		.start	= S3C2410_GPB(5),
		.end	= S3C2410_GPB(5),
		.flags	= IORESOURCE_IO,
		.name	= "led0",
	},

	[1] = {
		.start	= S3C2410_GPB(6),
		.end	= S3C2410_GPB(6),
		.flags	= IORESOURCE_IO,
		.name	= "led1",
	},

	[2] = {
		.start	= S3C2410_GPB(7),
		.end	= S3C2410_GPB(7),
		.flags	= IORESOURCE_IO,
		.name	= "led2",
	},

	[3] = {
		.start	= S3C2410_GPB(8),
		.end	= S3C2410_GPB(8),
		.flags	= IORESOURCE_IO,
		.name	= "led3",
	},
#else
	[0] = {
		.start	= PAD_GPIO_B + 26,
		.end	= PAD_GPIO_B + 26,
		.flags	= IORESOURCE_IO,
		.name	= "led0",
	},

	[1] = {
		.start	= PAD_GPIO_C + 11,
		.end	= PAD_GPIO_C + 11,
		.flags	= IORESOURCE_IO,
		.name	= "led1",
	},

	[2] = {
		.start	= PAD_GPIO_C + 7,
		.end	= PAD_GPIO_C + 7,
		.flags	= IORESOURCE_IO,
		.name	= "led2",
	},

	[3] = {
		.start	= PAD_GPIO_C + 12,
		.end	= PAD_GPIO_C + 12,
		.flags	= IORESOURCE_IO,
		.name	= "led3",
	},
#endif
};

static void led_release(struct device *devp)
{
	struct platform_device *pdev;

	pdev = container_of(devp, struct platform_device, dev);
	printk("Name:%s, removed.\n", pdev->name);
}

static struct platform_device led_devices = {
	.name		= "leds",
	//.name		= "fuck",
	//.name		= "shit",
	//.name		= "xiba",
	.id		= -1,
	.resource	= led_resources,
	.num_resources	= ARRAY_SIZE(led_resources),
	.dev		= {
		.release= led_release,
	},
};

static int __init led_single_dev_init(void)
{
	return platform_device_register(&led_devices);
}

static void __exit led_single_dev_exit(void)
{
	platform_device_unregister(&led_devices);
}

module_init(led_single_dev_init);
module_exit(led_single_dev_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("YYW");
